package com.sw.servlet.util;

/**
 * @author sw
 * @project minicat
 * @description http 协议工具 提供 200 和404
 * @date 2020/4/25 15:54
 */
public class HttpProtocolUtil {
    /**
     * 200 返回
     * @return
     */
    public static String getHttpHeader200(long contentLength) {
        return "HTTP/1.1 200 OK \n" +
                "Content-Type: text/html \n" +
                "Content-Length: " + contentLength + " \n" +
                "\r\n";
    }


    /**
     *
     * @return
     */
    public static String getHttpHeader404(){
        String str404="<h1>404 not founf</h1>";
        return "HTTP/1.1 404 NOT FOUND \n"+
                "content-Type: text/html \n+" +
                "content-Length: "+str404.getBytes().length+" \n"+
                "\r\n"+str404;
    }



}
